$(function() {
	$('#vue_vm_list div').hide();
});

var caregiver = {
	caregiverId: '',
	name: '',
	sex: '',
	cardId: '',
	phoneNumber: '',
	birthday: '',
	liveAddress: '',
	entryTime: '',
	contractTime: '',
	photoUrl: '',
	status: '',
	createTime: '',
	updateTime: '',
	createId: getLoginedUser()? getLoginedUser().staffId: '',
	updateId: getLoginedUser()? getLoginedUser().staffId: '',
	subjectRoomId: getLoginedUser()? getLoginedUser().subjectRoomId: '',
	subjectRoomName: getLoginedUser()? getLoginedUser().subjectRoomName: '',
	remark: '',
	personType: '',
	personTypeName: '',
};

var view = {
	data: caregiver
};

var vue_vm = new Vue({
	el: '#vue_vm',
	data: view
});

function save() {
	var loginedUser = getLoginedUser();
	view.data.subjectRoomId = loginedUser.subjectRoomId;
	view.data.birthday = $('#birthYear').val() + '-' + $('#birthMonth').val() + '-' + $('#birthDay').val();
	view.data.entryTime = $('#entryYear').val() + '-' + $('#entryMonth').val() + '-' + $('#entryDay').val();
	view.data.contractTime = $('#contractYear').val() + '-' + $('#contractMonth').val() + '-' + $('#contractDay').val();
	view.data.sex = (view.data.sex==''? 0: parseInt(view.data.sex));
	view.data.status = (view.data.status==''? 0: parseInt(view.data.status));
	view.data.personType = (view.data.personType==''? 0: parseInt(view.data.personType));

	save_basic(path+'/caregiver/save', {caregiver:view.data}, function() {
		alert('保存成功');
	});
}
